<%-- 
    Document   : reports
    Created on : Aug 25, 2011, 9:58:34 PM
    Author     : s4201567 Tony Yu
--%>
<style>
    #admin-poll { 
        padding-left: 40px;
        padding-bottom:40px;
    }
    #master-poll { 
        padding-left: 40px;
        padding-bottom:40px;
    }
    #creator-poll {
        padding-left: 40px;
        padding-bottom: 20px;
    }
    
    .polladmintable {
    font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
    width:92%;
    border:1px solid #009933;
    text-align:center;
    }
    .polladmintable td, .polladmintable th .polladmintable tr {
    font-size:1em;    
    border:1px solid #009933;
    padding:3px 7px 2px 17px;
    }
    .polladmintable th {
    font-size:1.1em;
    text-align:center;
    padding-top:5px;
    padding-bottom:4px;
    background-color:#008833;
    color:#ffffff;
    }
    
    #print {
        padding-top:20px;
    }
</style>

<script type="text/javascript">
    function printFunction() {
        document.getElementById("upper_container").hidden = true;
        document.getElementById("homeFooter").hidden = true;
        document.getElementById("pButton").hidden = true;
        window.print();
        document.getElementById("upper_container").hidden = false;
        document.getElementById("homeFooter").hidden = false;
        document.getElementById("pButton").hidden = false;
        return false;
    }
</script>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="../header.jsp" %>

    <div id="content-container">
        <div id="content">
               
            <h3 align="center">Producing Reports</h3>
            <div id = "admin-poll">
                <c:choose>   
                <c:when test="${not empty polls}">
                <table class="polladmintable">
                    <tr>
                        <th>Poll ID</th>
                        <th>Poll Name</th> 
                        <th>Total Number of User Participation</th>
                        <th>Geographical Location</th>
                    </tr>

                <c:forEach items="${polls}" var="poll">     
                    <tr>
                        <td>${poll.getUserID()}</td>
                        <td>${poll.getName()}</td>
                        <td>${poll.getUserID()}</td>
                        <td><a href="location.html?lat=<c:out value="${poll.getLatitude()}"/>&long=<c:out value="${poll.getLongitude()}"/>">Location</a></td>
                    </tr>
                </c:forEach>
                </table>
                </c:when>
                <c:otherwise>
                    No items for Polls!
                </c:otherwise>
                </c:choose>
            </div>

            <div id = "master-poll"> 
                <c:choose>   
                <c:when test="${not empty masters}">
                <table class="polladmintable">
                    <tr>
                        <th>Master ID</th>
                        <th>Master Name</th> 
                        <th>Assigned Poll</th>
                    </tr>
                    <tr>
                    <c:forEach items="${masters}" var="master">     
                        <td>${master.getUserID()}</td>
                        <td>${master.getUsername()}</td>
                    </c:forEach>
                    <c:forEach items="${creators}" var="creator">
                        <td>${creator.getAssignedPoll()}</td>
                    </c:forEach>
                   </tr>
                </table>
            </c:when>
            <c:otherwise>
                No items for Master-List!
            </c:otherwise>
            </c:choose>
            </div>
            
            <div id = "creator-poll"> 
                <c:choose>   
                <c:when test="${not empty creators}">
                <table class="polladmintable">
                    <tr>
                        <th>Creator ID</th>
                        <th>Creator Name</th> 
                        <th>Assigned Poll</th>
                    </tr>

                    <c:forEach items="${creators}" var="creator">     
                    <tr>
                        <td>${creator.getUserID()}</td>
                        <td>${creator.getUsername()}</td>
                        <td>${creator.getAssignedPoll()}</td>
                    </tr>
                    </c:forEach>
                </table>
                </c:when>
                <c:otherwise>
                    No items for Creator-List!
                </c:otherwise>
                </c:choose>
            </div>
            <div id="print">
                <center><input type="submit" id="pButton" onClick="printFunction()" value="Print"/></center><br/>
            </div>
    </div>		
		
<span id="homeFooter"><%@ include file="../footer.jsp" %></span>
